package hsit;

import cn.hutool.poi.excel.ExcelReader;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author huanggy
 * @date 2022/11/16
 **/
public class CustomerUpdateSQLGenerate {


    public static void main(String[] args) {

//        ExcelReader excelReader = new ExcelReader(new File("D:\\Application\\kc_customer.xlsx"), "Sheet1");
//        List<List<Object>> data = excelReader.read();
//
//
//        for (int i = 0; i < data.size(); i++) {
//            if (i > 0) {
//                List<Object> objects = data.get(i);
//                String licenseNo = String.valueOf((Long) objects.get(0));
//                String businessPlaceCode = (String) objects.get(3);
//
//                if ("便利店".equals(businessPlaceCode)) {
//                    businessPlaceCode = "1";
//                }
//                String marketCode = (String) objects.get(4);
//                String size = (String) objects.get(5);
//                String level = (String) objects.get(6);
//
//                System.out.println("update kc_customer set business_place_code = '" + businessPlaceCode + "', market_code = '" + marketCode + "' where license_code = '" + licenseNo + "';");
//            }
//        }
        build();
    }


    public static void build() {

        List<String> ids = Arrays.asList("1001220415000000008",
                "1001220418000000040",
                "1001220415000000042",
                "1001220415000000038",
                "1001220415000000039",
                "1001220415000000043",
                "1001220415000000032",
                "1001220415000000033",
                "1001220415000000028",
                "1001220415000000019",
                "1001220415000000020",
                "1001220415000000021",
                "1001220429000000001",
                "1001220415000000036",
                "1001220530000000103",
                "1001220530000000098",
                "1001220415000000037");

        String idPrefix = "10012211230000003";
        for (int i = 1; i <= ids.size(); i++) {
            String id = idPrefix + (i < 10 ? "0" + i : i);

            System.out.println("INSERT INTO `cc_category_property` (`id`,`gmt_create`,`gmt_modified`,`creator`,`modifier`,`is_deleted`,`manage_unit_id`,`category_id`,`property_id`,`type`,`is_required`,`is_input`,`is_multiple`,`is_enumerate`,`order_num`,`gmt_deleted`,`is_enable`,`tenant_id`,`biz_sharding_key`,`category_biz_code`,`search_type`,`is_keyword`) " +
                    "VALUES ('" + id + "','2022-11-23 15:16:04','2022-11-23 17:14:30','system_user_id','system_user_id','0','1','1001220419000000004','" + ids.get(i - 1) + "','PRODUCT','0','1','0','0',3,0,'1',null,null,null,'0','0');");
        }

    }


    public static void buildValue() {
        ExcelReader excelReader = new ExcelReader(new File("D:\\Application\\cc_category_value.xlsx"), "Sheet1");
        List<List<Object>> data = excelReader.read();
        String idPrefix = "10012211220000000";
        for (int i = 1; i <= data.size(); i++) {
            List<Object> objects = data.get(i - 1);
            String id = idPrefix + (i < 10 ? "0" + i : i);
            String categoryPropertyId = String.valueOf(objects.get(0));
            String propertyId = String.valueOf(objects.get(1));
            String valueId = String.valueOf(objects.get(2));
            String categoryId = "1001220523000000150";

            System.out.println("INSERT INTO `cc_category_property_value` (`id`,`gmt_create`,`gmt_modified`,`creator`,`modifier`,`is_deleted`,`manage_unit_id`,`category_property_id`,`category_id`,`property_id`,`value_id`,`order_num`,`gmt_deleted`,`tenant_id`,`biz_sharding_key`,`category_biz_code`) " +
                    "VALUES ('" + id + "','2022-11-22 17:14:23',null,'system_user_id',null,'0','system_manage_unit','" + categoryPropertyId + "','" + categoryId + "','" + propertyId + "','" + valueId + "',0,0,null,null,'dzy-smokingBullet');");
        }
    }
}
